#include "transient_addon.h"
#include "transient_backdrop.h"
#include "transient_decal.h"

#include "util/common_macros.h"
#include "util/mmgr.h"

using namespace backdrop;

TransientAddon::TransientAddon(bool AutoCreate)
{
	m_pTransient = AutoCreate ? (new TransientBackdrop()) : NULL;
}

TransientAddon::~TransientAddon()
{
	UTIL_SAFE_DELETE(m_pTransient);
}

TransientDecal* TransientAddon::AddTransientDecal(const std::string& name, const math::Vec2& pos, const math::Vec2& dir, int layer)
{
	if (!m_pTransient) return NULL;
	return m_pTransient->AddDecal(name, pos, dir, layer);
}

TransientDecal* TransientAddon::GetTransientDecal(const math::Vec2& pos)
{
	if (!m_pTransient) return NULL;
	return m_pTransient->GetDecal(pos);
}

void TransientAddon::DropTransientDecal(TransientDecal* pDecal, bool bDelete)
{
	if (m_pTransient)
		m_pTransient->DropDecal(pDecal, bDelete);
}
